package bigbeard.tools.net.server;


import bigbeard.tools.net.api.server.IServer;
import bigbeard.tools.net.server.impl.TcpSocketServerImpl;
import bigbeard.tools.net.server.impl.UdpSocketServerImpl;
import bigbeard.tools.net.server.impl.WebsocketServerImpl;
import bigbeard.tools.net.utils.Utils;

/**
 * @author bigbeard on 2022-09-29
 */
public class NetServerFactory {

    public static IServer create(String protocol) {
        protocol = protocol.toLowerCase();
        switch (protocol) {
            case Utils.WEB_SOCKET:
                return new WebsocketServerImpl();
            case Utils.TCP_CLIENT:
                return new TcpSocketServerImpl();
            case Utils.UDP_CLIENT:
                return new UdpSocketServerImpl();
            default:
                return null;
        }
    }
}
